import axios from '@/libs/request/axios'

/**
 * 获取挂牌车备案数据-多条件
 * @param params
 * @returns {*}
 */
export const getChannelListingCarTemp = (params) => {
    return axios.request({
        url: '/channel/carRel/getChannelListingCarTemp',
        method: 'POST',
        data: params,
    })
}

export const getRegister = (params) => {
    return axios.request({
        url: '/channel/carRel/getRegister',
        method: 'POST',
        data: params,
    })
}

/**
 *新增挂牌车备案
 * @param obj
 * @returns {*}
 */
export function save(obj) {
    return axios.request({
        url: '/channel/carRel/save',
        method: 'POST',
        data: obj
    })
}

/**
 * 修改挂牌车备案
 * @param obj
 * @returns {*}
 */
export function edit(obj) {
    return axios.request({
        url: '/channel/carRel/edit',
        method: 'POST',
        data: obj
    })
}

/**
 * 删除挂牌车备案
 * @param id
 * @param params
 * @returns {*}
 */
export const deleteChannel = (obj) => {
    return axios.request({
        url: `/channel/carRel/delete`,
        method: 'POST',
        data: obj,
    })
};

// 获取合作商名称
export function getBaseInfo(obj) {
    return axios.request({
        url: '/channel/channelBaseInfo/getBaseInfo',
        method: 'POST',
        data: obj
    })
}

// 删除用户
export const delAllByIds = (ids) => {
    return axios.request({
        url:`/channel/carRel/delAllByIds/${ids}`,
        method: 'delete'
    })
}

// 停用挂牌车
export const upAllByIds = (ids) => {
    return axios.request({
        url:`/channel/carRel/upAllByIds/${ids}`,
        method: 'delete'
    })
}

// 根据id 查询这一条数据信息
export function getById(obj) {
    return axios.request({
        url: '/channel/carRel/getById',
        method: 'POST',
        data: obj
    })
}
// 审批
export function toExamine(obj) {
    return axios.request({
        url: '/channel/carRel/toExamine',
        method: 'POST',
        data: obj
    })
}

// 模板下载
export const downloadReport = (params) => {
    return axios.request({
        url: `/channel/carRel/downloadReport`,
        data: params,
        method: 'post',
        responseType: "blob"
    })

}
/**================================ 分割线=======================下面是进件使用的===========上面 渠道用的=============== */

//获取登录用户信息
export function getChannelId(obj) {
    return axios.request({
        url: '/apply/applyUserChannel/getChannelId',
        method: 'POST',
        data: obj
    })
}

export const getApplyChannelListingCarTemp = (params) => {
    return axios.request({
        url: '/apply/applyUserChannel/getChannelListingCarTemp',
        method: 'POST',
        data: params,
    })
}

// 获取合作商名称
export function getChannelBaseInfo(obj) {
    return axios.request({
        url: '/apply/applyUserChannel/getBaseInfo',
        method: 'POST',
        data: obj
    })
}

/**
 * 删除挂牌车备案
 */
export const getChanneldeleteChannel = (obj) => {
    return axios.request({
        url: `/apply/applyUserChannel/carTempDelete`,
        method: 'POST',
        data: obj,
    })
};

/**
 * 修改挂牌车备案
 * @param obj
 * @returns {*}
 */
export function channelEdit(obj) {
    return axios.request({
        url: '/apply/applyUserChannel/carTempEdit',
        method: 'POST',
        data: obj
    })
}

// 停用挂牌车
export function channelUpAllByIds(ids) {
    return axios.request({
        url:'/apply/applyUserChannel/channelUpAllByIds',
        method: 'POST',
        data: {ids:ids}

    })
}

/**
 *新增挂牌车备案
 * @param obj
 * @returns {*}
 */
export function channelSave(obj) {
    return axios.request({
        url: '/apply/applyUserChannel/carsave',
        method: 'POST',
        data: obj
    })
}

// 根据id 查询这一条数据信息
export function getChannelById(obj) {
    return axios.request({
        url: '/apply/applyUserChannel/getCarTempById',
        method: 'POST',
        data: obj
    })
}

// 审批
export function channelToExamine(obj) {
    return axios.request({
        url: '/apply/applyUserChannel/channelToExamine',
        method: 'POST',
        data: obj
    })
}

export function getCarByVin(obj) {
    return axios.request({
        url: '/apply/vin/newCarKeyParameters',
        method: 'POST',
        data: obj
    })
}

export function getListingCarParams(obj) {
    return axios.request({
        url: '/apply/applyUserChannel/getListingCarParams',
        method: 'POST',
        data: obj
    })
}
